/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mygame;

import com.jme3.math.Spline;
import com.jme3.math.Vector3f;
import com.jme3.scene.Mesh;

/**
 *
 * @author Abe
 */
public class BezierPatch extends Mesh {

    private static final int DEFAULT_GRID_RESOLUTION = 3;

    /**
     * @return the DEFAULT_GRID_RESOLUTION
     */
    public static int getDEFAULT_GRID_RESOLUTION() {
        return DEFAULT_GRID_RESOLUTION;
    }
    private int grid_resolution = DEFAULT_GRID_RESOLUTION;
    private Vector3f[][] controlPoints = new Vector3f[4][4];

    public BezierPatch(Vector3f[][] contPoints) {
        controlPoints = contPoints;
        buildMesh();

    }

    private void buildMesh() {
        Spline[][] fixedCurves = new Spline[2][4];
        Spline[][] slidingCurves = new Spline[2][2];

        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 4; j++) {
                controlPoints[i][j] = new Vector3f(i, j, 0);
            }
        }
        for (int i = 0; i < 4; i++) {
            fixedCurves[0][i] =
                    new Spline(Spline.SplineType.Bezier, controlPoints[i], 0, true);

        }
        for (int j = 0; j < 4; j++) {
            Vector3f[] tempCPs = new Vector3f[4];
            for (int i = 0; i < 4; i++) {
                tempCPs[i] = controlPoints[i][j];
                fixedCurves[1][j] =
                        new Spline(Spline.SplineType.Bezier, tempCPs, 0, true);
            }
        }

        throw new UnsupportedOperationException("Not yet implemented");
    }

    /**
     * @return the grid_resolution
     */
    public int getGrid_resolution() {
        return grid_resolution;
    }

    /**
     * @param grid_resolution the grid_resolution to set
     */
    public void setGrid_resolution(int grid_resolution) {
        this.grid_resolution = grid_resolution;
    }

    /**
     * @return the controlPoints
     */
    public Vector3f[][] getControlPoints() {
        return controlPoints;
    }

    /**
     * @param controlPoints the controlPoints to set
     */
    public void setControlPoints(Vector3f[][] controlPoints) {
        this.controlPoints = controlPoints;
    }
}
